package com.lijiaxing.config;

import com.lijiaxing.interceptors.Interceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    //将拦截器挂载
    @Autowired
    private Interceptor interceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //除一下请求之外都会被拦截
        registry.addInterceptor(interceptor).excludePathPatterns("/get/code", "/user/authentication", "/login");
    }
}
